package cn.javass.dp.state.example7;

import java.util.Scanner;

public class DepManagerState implements State {
    @Override
    public void doWork(StateMachine ctx) {
        //先把业务对象造型回来
        LeaveRequestModel lrm = (LeaveRequestModel) ctx.getBusinessVO();
        //业务处理，把审核结果保存到数据库中
        System.out.println("部门经理审核中。。。");
        Scanner scanner = new Scanner(System.in);
        if (scanner.hasNext()) {
            int a = scanner.nextInt();
            String result = "不同意";
            if (a == 1) {
                result = "同意";
            }
            lrm.setResult("部门经理："+result);
        }
        //部门经理审核过后，直接转向审核结束了
        ctx.setState(new AuditOverState());
        //让申请人查看
        ctx.doWork();
    }
}
